From 3de1ac2405d668a2ade90c20ae44a37ea1c66fac Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Mon, 3 Jul 2006 08:57:15 +0100 Subject: [PATCH] [NET] back: Fix off-by-one error in netbk_tx_err The generalised extra request info patch introduced a bug with the use of netbk_tx_err since it advanced the req_cons pointer by one. This patch fixes thing by delaying the increment in netbk_tx_err. Signed-off-by: Herbert Xu --- linux-2.6-xen-sparse/drivers/xen/netback/netback.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c index 93e39612bc..5171d0ab02 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c @@ -496,9 +496,9 @@ static void netbk_tx_err(netif_t *netif, netif_tx_request_t *txp, RING_IDX end) do { make_tx_response(netif, txp, NETIF_RSP_ERROR); - if (++cons >= end) + if (cons >= end) break; - txp = RING_GET_REQUEST(&netif->tx, cons); + txp = RING_GET_REQUEST(&netif->tx, cons++); } while (1); netif->tx.req_cons = cons; netif_schedule_work(netif); @@ -764,11 +764,11 @@ static void net_tx_action(unsigned long unused) if (txreq.flags & NETTXF_extra_info) { work_to_do = netbk_get_extras(netif, extras, work_to_do); + i = netif->tx.req_cons; if (unlikely(work_to_do < 0)) { - netbk_tx_err(netif, &txreq, 0); + netbk_tx_err(netif, &txreq, i); continue; } - i = netif->tx.req_cons; } ret = netbk_count_requests(netif, &txreq, work_to_do); -- 2.30.2